<?php

class pemesanan{
	
	// Class Constructor
	public function __construct(){
		$this->db = new DBClass();
	}
	
	public function getPesan(){
		
		$query = "Select * from pemesanan";
		$rows = $this->db->getRows($query);
		
		return $rows;
	}

	public function get_data(){
		$query = "select idadmin, username, fullname, email from admin 
			where username='".$_COOKIE['c_usr']."'";

		$rows = $this->db->getRows($query);

		return $rows[0];	
	}

	public function pesan($data){
	$query ="INSERT INTO pemesanan SET asal='".@$data['asal']."',
	tujuan='".@$data['tujuan']."',
	tangal='".@$data['tanggal']."',
	kelas='".@$data['kelas']."'";

	$rows = $this->db->putRows($query);

	header('Location: pemesanan.php');
}
}